<?php

class Grade_converter
{

	private $CI;
	public function __construct()
	{
		$this->CI =& get_instance();
		$this->CI->load->model('M_student_grades','msg');
	}
	
	public function convert($data = '')
	{
		$sql = 'SELECT letter 
				FROM grading_system
				WHERE (? >= range_start AND ? <= range_end )
				LIMIT 1';
		$q = $this->CI->db->query($sql,array(intval($data),intval($data)));
		
		return $q->num_rows() >= 1 ? $q->row()->letter : FALSE;
	}
}